Asynchronous flush and restore of distributed history buffer

ABSTRACT

Techniques are disclosed for performing a flush and restore of a history buffer (HB) in a processing unit. One technique includes identifying one or more entries of the HB to restore to a register file in the processing unit. For each of the one or more HB entries, a determination is made whether to send the HB entry to the register file via a first restore bus or via a second restore bus, different from the first restore bus, based on contents of the HB entry. Each of the one or more HB entries is then sent to the register file via one of the first restore bus or the second restore bus, based on the determination.

BACKGROUND

The present disclosure generally relates to data processing systems, and more specifically, to techniques for performing a flush and restore of a distributed history buffer in a processing unit.

High performance processors currently used in data processing systems today may be capable of “superscalar” operation and may have “pipelined” elements. Such processors may include multiple execution/processing slices that are able to operate in parallel to process multiple instructions in a single processing cycle. Each execution slice may include a register file and history buffer that includes the youngest and oldest copies, respectively, of architected register data. Each instruction that is fetched may be tagged by a multi-bit instruction tag. Once the instructions are fetched and tagged, the instructions may be executed (e.g., by an execution unit) to generate results, which are also tagged. A Results (or Writeback) Bus, one per execution slice, feeds all slices with the resultant instruction finish data. Thus, any individual history buffer generally includes one write port per Results/Writeback bus.

In traditional processors, the history buffer is typically a centralized component of the processing unit, such that it can back up the data when a new instruction is dispatched and the target register has to be saved into the back up register file. However, such centralized components may not be feasible for processors that include multiple execution/processing slices. For example, in processors with a large number of processing slices, the number of ports needed for such a centralized history buffer can be extensive, leading to an extensive amount of wires between the distributed execution units.

However, including numerous write ports on a history buffer can be expensive to implement in the circuit. For example, as the number of ports associated with the history buffer increases, the circuit area of the history buffer in the processing unit can grow rapidly. This, in turn, creates a compromise on the number of history buffer entries that can be supported in a given circuit area. For example, smaller history buffers generally fill up faster and can impact performance, stalling the dispatch of new instructions until older instructions are retired and free up history buffer entries. On the other hand, larger history buffers are generally expensive to implement and lead to larger circuit size.

To address the limitations associated with centralized history buffers, some processing units may use a distributed history buffer design. In a distributed history buffer design, the history buffer may include multiple distributed levels to provide support for the main line execution of instructions in the processing unit. The use of distributed history buffers, however, has prompted new issues to emerge as areas of concern. One such issue relates to recovery operations for restoring the registers in the register file to the proper states.

SUMMARY

One embodiment presented herein includes a method for performing a flush and restore of a history buffer (HB) in a processing unit. The method generally includes identifying one or more entries of the HB to restore to a register file in the processing unit. The method also includes determining, for each of the one or more HB entries, whether to send the HB entry to the register file via a first restore bus or via a second restore bus, different from the first restore bus, based on contents of the HB entry. The method further includes sending each of the one or more HB entries to the register file via one of the first restore bus or the second restore bus, based on the determination.

Other embodiments include, without limitation, a computer program product that includes a storage medium having computer-readable program code that enables a processing unit to implement one or more aspects of the disclosed methods as well as a system having a processor, memory, and application programs configured to implement one or more of the disclosed methods.

BRIEF DESCRIPTION OF THE SEVERAL VIEWS OF THE DRAWINGS

FIG. 1 illustrates an example of a data processing system configured to perform a flush and restore of a distributed history buffer, according to one embodiment.

FIG. 2 illustrates a block diagram of a processor that includes one or more history buffer restoration components, according to one embodiment.

FIG. 3 illustrates a block diagram of a multi-slice processor 300 configured to perform a flush and restore of a distributed history buffer, according to one embodiment.

FIG. 4 illustrates an example of a restore function at a register file, according to one embodiment.

FIG. 5 illustrates an example of a restore operation at a distributed history buffer, according to one embodiment.

FIG. 6 further illustrates an example of the restore operation at a distributed history buffer, according to one embodiment.

FIG. 7 is a flow chart illustrating a method for using a history buffer restoration component to perform a flush and restore of a distributed history buffer, according to one embodiment.

FIG. 8 is a flow chart illustrating another method for using a history buffer restoration component to perform a flush and restore of a distributed history buffer, according to one embodiment.

DETAILED DESCRIPTION

A processing unit may use a distributed (e.g., multi-level) history buffer (HB) design to overcome the limitations associated with a single level HB. In one reference example, a split-level (two-level) HB may be used in the processing unit. In a split HB design, a smaller first level (L1) HB may include multiple write ports for sinking the multiple write back busses (e.g., one write port per results/write back bus). The L1 HB can move an entry to a larger second level (L2) HB after the valid data for the L1 HB entry has been written back by the write back bus. The write back ITAG compares occur on the fewer number of entries in the L1 HB. The L2 HB may have a greater number of entries than the L1 HB. However, the L2 HB may include a fewer number of write ports (compared to the L1 HB), reducing the circuit size of the L2 HB. In general, however, a processing unit may include a distributed HB with any number of levels (e.g., three levels or more).

In some cases, data that is saved in the HB may have to be restored to the registers (e.g., general purpose registers (GPRs)) in the future. Data may be flushed from the GPRs and need to be restored from the HB for a variety of reasons. One reason is branch mis-prediction, where a processing unit mis-predicts the next instruction to process in branch prediction. Other reasons for a flush include interrupts, load data misses, data errors, etc.

In processing units that use a distributed HB design, the conventional recovery process typically involves marking HB entries (e.g., having data to be recovered) and reading the entries out of the HB. The data is then sent through the issue queue, which issues an instruction (e.g., an error correcting code (ECC) correction instruction) to the execution unit (e.g., fixed/floating point unit, such as a vector scalar unit (VSU)). The execution unit may perform an error recovery process, and place the recovery data on its own result bus (e.g., write back bus). The data can then travel from the result bus to all of the GPR copies to write in the recovery data. Each distributed HB can be recovered simultaneously this way through their respective execution unit. Performing this process, however, for each HB entry in the distributed HB can take a significant amount of time. For example, in some cases, a HB entry may not have write back data (e.g., write back data may not have been written to the entry). Processing units that use traditional recovery techniques for distributed HBs, however, generally send the HB entry through the path of the issue queue and execution unit regardless of whether the HB entry has write back data. However, sending each HB entry through the path of the issue queue and execution unit can significantly increase the amount of time it takes for a flush/restore operation, and in turn, impact the performance of the processing unit.

Accordingly, embodiments presented herein provide improved techniques for performing a flush and restore of a distributed HB in a processing unit, relative to conventional techniques for performing a flush/restore of a HB. As described below, using the techniques described herein, the distributed HB can broadcast its restoration data and instruction tag (ITAG) to all other processing slices on the same thread. The processing unit can restore one HB entry's ITAG without write back data, and restore another HB entry's ITAG with write back data at the same time.

For example, the processing unit may include two restore buses: a “ITAG only” restore bus, and a “ITAG+Write Back (WB) data” restore bus. The “ITAG+WB data” restore bus may be a bus going from the distributed HB to the issue queue to be issued out to the execution unit. The data from the execution unit may be written back into the register file via a write back mechanism. On the other hand, the “ITAG only” restore bus may be a direct bus going from the distributed HB to the register file (e.g., bypassing the issue queue and execution unit), and may be used for restoring HB entries without write back data. For example, if an HB entry to be restored does not contain write back data (e.g., an “ITAG only” restoration), then the ITAG associated with that HB entry can be sent directly through a dedicated ITAG bus to each register file (in each processing slice) without going through the issue queue and the execution unit. In this manner, the processing unit can significantly reduce the amount of time it takes to move data from a distributed HB into a register file at flush or exception points.

Note, to clearly point out novel features of the present invention, the following discussion omits or only briefly describes conventional features of information processing systems which are apparent to those skilled in the art. It is assumed that those skilled in the art are familiar with the general architecture of processors, and in particular with processors which operate in an in-order dispatch, out-of-order execution, in-order completion fashion. It may be noted that a numbered element is numbered according to the figure in which the element is introduced, and is referred to by that number throughout succeeding figures.

FIG. 1 illustrates an example of a data processing system 100 that may include a HB restoration component for performing a flush/restore of one or more distributed HBs, according to one embodiment. The system has a central processing unit (CPU) 110 such as a PowerPC microprocessor (“PowerPC” is a trademark of IBM Corporation). The CPU 110 is coupled to various other components by system bus 112. Read only memory (“ROM”) 116 is coupled to the system bus 112 and includes a basic input/output system (“BIOS”) that controls certain basic functions of the data processing system 100. Random access memory (“RAM”) 114, I/O adapter 118, and communications adapter 134 are also coupled to the system bus 112. I/O adapter 118 may be a small computer system interface (“SCSI”) adapter that communicates with a disk storage device 120. Communications adapter 134 interconnects bus 112 with an outside network enabling the data processing system to communicate with other such systems. Input/Output devices are also connected to system bus 112 via user interface adapter 122 and display adapter 136. Keyboard 124, track ball 132, mouse 126 and speaker 128 are all interconnected to bus 112 via user interface adapter 122. Display monitor 138 is connected to system bus 112 by display adapter 136. In this manner, a user is capable of inputting to the system through the keyboard 124, trackball 132 or mouse 126 and receiving output from the system via speaker 128 and display 138. Additionally, an operating system such as AIX (“AIX” is a trademark of the IBM Corporation) is used to coordinate the functions of the various components shown in FIG. 1.

The CPU (or “processor”) 110 includes various registers, buffers, memories, and other units formed by integrated circuitry, and operates according to reduced instruction set computing (“RISC”) techniques. The CPU 110 processes according to processor cycles, synchronized, in some aspects, to an internal clock (not shown).

FIG. 2 illustrates a block diagram of a processor 110 that may be configured to perform a flush/restore of a distributed HB, according to one embodiment. Processor 110 may include one or more HB restoration components and one or more distributed HBs. Processor 110 has a bus interface unit 202 coupled to the bus 112 for controlling transfers of data and instructions between memory, such as random access memory 114, and caches, e.g. instruction cache (I-Cache) 204 and data cache (D-Cache) 206.

Instructions may be processed in the processor 110 in a sequence of logical, pipelined stages. However, it should be understood that the functions of these stages, may be merged together, so that this particular division of stages should not be taken as a limitation, unless such a limitation is indicated in the claims herein. Indeed, some of the previously described stages are indicated as a single logic unit 208 in FIG. 2 for the sake of simplicity of understanding and because each distinction between stages is not necessarily central to the present invention.

Logic unit 208 in FIG. 2 includes fetch, branch processing, instruction buffer, decode and dispatch units. The logic unit 208 fetches instructions from instruction cache 204 into the instruction buffer, either based on a normal sequence of the instructions or, in the case of a sequence having a conditional branch instruction, a predicted sequence, the predicted sequence being in accordance with addresses selected by the branch processing unit. The logic unit 208 also decodes the instructions and dispatches them to an appropriate functional unit (e.g., execution unit) 212.0, 212.1, . . . 212.n−1 via reservation station 210. In one embodiment, logic unit 208 may include an instruction sequencing unit (ISU) (not shown) for dispatching the instructions to the appropriate functional units. In executing the instructions, the units 212 input and output information to registers (shown collectively as register file (RF) 216). The functional units 212 signal the completion unit 218 upon execution of instructions and the completion unit 218 retires the instructions, which includes notifying history buffer (HB) unit 214. The HB unit 214 may save a processor state before, for example, an interruptible instruction, so that if an interrupt occurs, HB control logic may recover the processor state to the interrupt point by restoring the content of registers. RF 216 may include an array of processor registers (e.g., GPRs, VSRs, etc.). RF 216 can include a number of RF entries or storage locations, each RF entry storing a 64 bit double word and control bits. In some cases, an RF entry may store 128 bit data. In one embodiment, RF 216 is accessed and indexed by logical register (LREG) identifiers, e.g., r0, r1, . . . , rn. Each RF entry holds the most recent (or youngest) fetched instruction and its ITAG. In some cases, each RF entry may also hold the most recent (or youngest) target result data corresponding to a LREG for providing the result data to a next operation. A new dispatch target replaces (or evicts) a current RF entry. In such cases, the current RF entry can be moved to the HB unit 214. HB logic 214 may use a multi-level or distributed HB in processor 110.

The functional units 212 also assert results on one or more result buses (e.g., write back buses) 230 so that the results may be written by one or more write ports 220 to the registers in the RF 216. In addition to notifying the HB unit 214 about retired instructions, the completion unit 218 or logic unit 208 may also notify the HB unit 214 about exception conditions and mis-predicted branches for which instructions should be discarded prior to completion and for which the HB unit 214 should recover a state of the processor 110 as will be further described below. The HB unit 214 may also receive other information about dispatched instructions from the logic unit 208, the RF 216, and one or more functional units 212.

In some embodiments, a CPU 110 may have multiple execution/processing slices with each slice having one or more of the units shown in FIG. 2. For example, each processing slice may have its own logic unit 208, RF 216, HB unit 214, reservation station 210 and functional/execution units 212. A CPU 110 having the multiple processing slices may be capable of executing multiple instructions simultaneously, for example, one instruction in each processing slice simultaneously in one processing cycle. Such a CPU having multiple processing slices may be referred to as a multi-slice processor or a parallel-slice processor. Each processing slice may be an independent processor (e.g., processor 110) and may execute instructions independently of other processing slices in the multi-slice processor.

In some embodiments, HB unit 214 may include a HB restoration component (or logic) for performing a flush/restore of a distributed HB (e.g., used by the HB unit 214). For example, in each processing slice of CPU 110 there may be two restore buses, an “ITAG only” restore bus and an “ITAG+WB data” restore bus. The HB restoration component may read out one or more HB entries to be restored at the same time. For example, in some cases, the HB restoration component can read out two HB entries to be restored at the same time: one “ITAG only” entry and one “ITAG+WB data” entry. If the HB unit 214 (e.g., via the HB restoration component) determines that an HB entry to be restored does not contain write back data, then the HB unit 214 may send the ITAG associated with that HB entry directly through a dedicated ITAG bus to each register file (in each processing slice) without going through (or bypassing) the issue queue and the execution unit. On the other hand, if the HB unit 214 (e.g., via the HB restoration component) determines that an HB entry to be restored does contain write back data, then the HB unit 214 may send the HB entry to the issue queue to be written back to the register file through the execution unit via a write back mechanism (e.g., via WB bus 230).

FIG. 3 illustrates a multi-slice processor 300 configured to perform a flush/restore of a distributed HB, according to one embodiment. It may be noted that FIG. 3 only shows portions/components of the multi-slice processor 300 that are relevant for this discussion. In this example, the multi-slice processor 300 includes two processing slices, Slice 0 and Slice 1. Each of the Slices 0 and 1 may include a distributed HB. In this example, each Slice 0 and 1 includes a two level HB: a L1 HB (302 a and 302 b) and a L2 HB (304 a and 304 b). Each level of HB may be implemented as a separate circuit in the processor. The L2 HB 304 may include a greater number of entries than the L1 HB 302. For example, in one embodiment, the L1 HB 302 may include 16 HB entries and the L2 HB 304 may include 80 HB entries. Note, however, that the L1 HB 302 and L2 HB 304 may include any number of entries. Each Slice 0 and 1 also includes an issue queue (ISQ) (306 a and 306 b), and execution unit(s) (308 a and 308 b). The execution unit(s) 308 may include a load store unit (LSU), vector scalar unit (VSU), etc. A logic unit (e.g., logic unit 208) may perform instruction fetch and dispatch for the multi-slice processor. As shown, Slices 0 and 1 may share one or more register file(s) 310, which may be configured as a register bank, and register file control logic 312. In some embodiments, Slices 0 and 1 may each include a register file. Slices 0 and 1 may use register file 310, register file control logic 312 and other components therein for register renaming.

The ISQ 306 can hold a set of instructions and the reservation station (not shown in FIG. 3) can accumulate data for the instruction inputs. In some embodiments, the reservation station may be a part of the ISQ 306. Typically, when an instruction is dispatched, the ISQ 306 may allocate an RF entry for the instruction. The source RF entries required as input for the instruction are looked up and passed on to the reservation station. When all source data accumulates for the instruction, the reservation station passes it on to one or more execution units designated for execution of the instruction. Each of the execution units 308 may make result data available on the write back buses (e.g., WB bus 230) for writing into a RF entry or HB entry.

It may be noted that the two slices are shown for ease of illustration and discussion only, and that multi-slice processor 300 may include more than two slices with each slice having all the components discussed above for each of the slices 0 and 1. Further, the processing slices may be grouped into super slices (SS), with each super slice including a pair of processing slices. For example, a multi-slice processor may include two super slices SS0 and SS1, with SS0 including slices 0 and 1, and SS1 including slices 2 and 3. In some cases, one register file 216 may be allocated per super slice and shared by the processing slices of the super slice.

In some embodiments, the slices 0 and 1 of the multi-slice processor 300 may be configured to simultaneously execute independent threads (e.g., one thread per slice) in a simultaneous multi-threading mode (SMT). Thus, multiple threads may be simultaneously executed by the multi-slice processor 300. In some embodiments, a super slice may act as a thread boundary. For example, in a multi thread mode, threads T0 and T1 may execute in SS0 and threads T2 and T3 may execute in SS1. Further, in a single thread (ST) mode, instructions associated with a single thread may be executed simultaneously by the multiple processing slices of at least one super slice, for example, one instruction per slice simultaneously in one processing cycle. The simultaneous processing in the multiple slices may considerably increase processing speed of the multi-slice processor 300.

Typically, when a new instruction (e.g., second instruction) (targeting one of the LREGs in the register file 310) is dispatched, the new instruction may evict the current RF entry associated with the previous instruction (e.g., first instruction), and the current RF entry may be moved to the L1 HB 302. Each entry in the L1 HB 302, therefore, may include an ITAG of the previous instruction, the previous instruction, the evictor ITAG of the new instruction and/or one or more control bits. In some cases, the L1 HB entry may also include result data for the first instruction (e.g., from the write back bus 230). In some embodiments, when valid data has been written back to an entry in the L1 HB 302, the L1 HB entry can be moved to the L2 HB 304.

As noted above, the HB unit 214 (via the HB restoration component) may be configured to perform flush/restore of a distributed HB in each processing slice of the multi-slice processor 300, for example, to reduce the amount of time it takes to move data from the distributed HB into a register file at flush or exception points. As shown, each Slice 0 and 1 of the multi-slice processor 300 includes two restore buses: a “direct ITAG only” restore bus 330 (e.g., restore bus 330A in Slice 0 and restore bus 330B in Slice 1); and a “ITAG+WB data” restore bus 340 (e.g., restore bus 340A in Slice 0 and restore bus 340B in slice 1). The “direct ITAG only” bus 330 is a direct restore bus from the distributed HB (e.g., L1 HB 302 and L1 HB 304) to the register file control logic 312. As shown, the “direct ITAG only” bus 330 bypasses the ISQ 306, execution unit(s) 308 and write back bus to register file 310. The “ITAG+WB data” restore bus 340 is a restore bus from the distributed HB to the ISQ 306 to be issued out to the execution unit 308. In some cases, the “ITAG+WB data” restore bus 340 may bypass the ISQ 306.

In a flush and restore operation, logic unit 208 may determine to restore one or more entries of the register file 310 with entries of the L1 HB 302 and/or L2 HB 304, and signal the HB restoration component to perform a flush and restore operation. The logic unit 208 may send a flush ITAG to the HB restoration component and the HB restoration component may independently perform two different ITAG compares on L1 HB 302 and/or L2 HB 304 based on the flush ITAG. The HB restoration component may perform the flush compare for the distributed HB only (e.g., the HB restoration component may not have to perform flush compares for the GPR/VRF entries in the register file 310). In a first ITAG compare, the flush ITAG, evictor ITAG, and entry ITAG are compared. If the entry ITAG is greater/older than the flush ITAG and the flush ITAG is older than/equal to the evictor ITAG, then the entry may be marked for restoration (e.g., a restore pending (RP) bit may be set to 1 for the entry). In a second ITAG compare, the flush ITAG and entry ITAG are compared. If the flush ITAG is older/equal to the entry ITAG, then the entry can be invalidated.

The HB restoration component may generate two vectors of HB entries to be restored once the flush compares with the evictor ITAG in each entry of the L1 HB and L2 HB are completed. One vector may be used to indicate which HB entries need to restore ITAG only (e.g., “ITAG only” restoration, entries which have not been written back). The other vector may be used to indicate which HB entries need to restore both ITAG and WB data (e.g., “ITAG+WB data” restoration). In one embodiment, the HB restoration component may read out two HB entries to be restored at the same time. For example, the HB restoration component can read out one “ITAG only” entry and one “ITAG+WB data” entry. The HB restoration component can send the “ITAG only” entry directly from the distributed HB (e.g., (L1 HB 302 or L2 HB 304) to the RF control 312 (e.g., in each processing slice) without going through the ISQ 306 and execution unit(s) 308. The HB restoration component can send the “ITAG+WB data” entry from the distributed HB to the ISQ 306 to be issued out to the execution unit(s) 308. The WB data may be written back into the RF via the normal RF write back mechanism.

FIG. 4 illustrates an example of a restore function at a register file (e.g., register file 310), according to one embodiment. In particular, FIG. 4 depicts a view of the restore function at the register file 310 from the perspective of the processing slices of the multi-slice processor 300. From the perspective of the processing slices, the register file 310 is addressed by LREG(s). For example, the processing slices may decode the LREG(s) from the distributed HB (in the respective processing slices) into a 1-hot write enable vector. As shown, there may be eight LREG vectors, one LREG vector from each processing slice. In some cases, the processing slices may indicate for a given LREG vector that the restore and particular RF are on the same thread. Each LREG vector goes to the GPR register file. Each register file entry may include a writeback bit (W), a history bit (H), and ITAG valid (ITAG+V) (e.g., from the distributed HB) and data (e.g., from the distributed HB). In one embodiment, setting the writeback bit (W) to “1” may indicate that all writebacks for a thread are finished, and setting the history bit (H) to “1” may indicate that the data was saved previously and may have to be saved at a future time. In some cases, the ITAG associated with the ITAG+V may no longer be valid (e.g., in the case of completed data).

Referring again to FIG. 3, in some embodiments, for HB entries that already have WB data to be restored, the HB restoration component may determine whether to perform a synchronous restore operation or asynchronous restore operation, based on the contents of the HB entries to be restored.

For example, if the HB restoration component determines there are “ITAG only” HB entries to be restored, then the HB restoration component may use both the dedicated “ITAG only” bus 330 and “ITAG+WB data” bus 340 to restore two HB entries synchronously. For the HB entries that only have an ITAG (e.g., no WB data), the HB restoration component may send these ITAGs directly from the distributed HB to all of the slice register file controls for restoration (e.g., to the register file) via the “ITAG only” bus 330. On the other hand, for the HB entries that were already written back (e.g., HB entries have WB data), the HB restoration component can send the ITAG and WB data for these HB entries through the ISQ 306 to be issued out to the execution unit 308. The execution unit 308 can put the result data on its result bus (e.g., WB bus 230), and the data can be written to the register file 310 through the normal write back mechanism.

If the HB restoration component determines there are no “ITAG only” HB entries to be restored (e.g., all HB entries with “ITAG only” have already been restored), and all the remaining HB entries have write back data, then the HB restoration component may send the restore ITAG and WB data asynchronously to speed up dispatch after flush/restore handling. For example, in this situation, the HB restoration component may send the restore ITAG and restore data asynchronously on different busses. The HB restoration component may send the restore ITAG first (e.g., on the “ITAG only” bus 330) from the distributed HB to write into the register file control 312. The HB restoration component may send the restore ITAG first to write into the register file control 312 as fast as possible (e.g., before the restore data arrives from the write back bus). Once the restore ITAG is sent, the HB restoration component may send the restore data (e.g., after a predetermined number of cycles) on the write back bus (e.g., WB bus 230). The register file control 312 may sync the restore data with the previously sent restore ITAG before writing the ITAG and WB data into the register file 310.

In some embodiments, as soon as the last restore ITAG is visible in the register file control 312, the dispatch can resume before the data shows up in the register file 310. When dispatch resumes, if an instruction needs operand data that is in the process of being restored, the data can be retrieved from the register file 310 (e.g., via a RF normal read), assuming the operand is already in the register file 310. On the other hand, if the operand has not been written into the register file 310, the data can be obtained from a RF bypass multiplexer. In this case, the register file control logic 312 can perform a compare between the dispatching source LREG and the source of the restoring LREG. If there is a match, then the register file control logic 312 can bypass the restoring data to the dispatching instruction.

FIG. 5 illustrates an example of a restore function performed by the HB restoration component at the distributed HB, according to one embodiment. As noted, the HB restoration component may independently perform two ITAG compares on each level of the distributed HB, e.g., to determine which entries need to be written back to the register file. Note that while FIG. 5 shows the restore function for one level (e.g., L1 HB 502) of the distributed HB, those of ordinary skill in the art will recognize that the HB restoration component may perform the restore function for each level of the distributed HB.

As shown, L1 HB 502 includes 48 HB entries. The restore function may begin with the L1 HB 502 receiving a flush ITAG (e.g., from the logic unit 208). Once the flush ITAG is received, the L1 HB 502 (using the HB restoration component) may perform first magnitude compares of the flush ITAG against the ITAG and evictor ITAG in each occupied HB entry. The L1 HB 502 may set a restore pending (RP) flag (or bit) in every entry where the condition “ITAG<Flush ITAG≤Evictor ITAG” is met. There are two types of RP flags: (1) a RP_ITAG_only flag, which is used for when the data has not been written back and (2) a RP_WB flag, which is used for when the data has been written back. Note, that in some cases, an HB entry may not have data written back when the flush restore process is in progress, thus RP_ITAG_only may be set to 1 for that entry. However, during the restore process, if data is written back, then the bit RP_ITAG_only will be set to 0, and the RP_WB bit will be set to 1.

The L1 HB 502 (via the HB restoration component) may also perform second magnitude compares of the Flush ITAG and ITAG to determine which HB entries of the L1 HB 502 to invalidate/clear. For example, as shown, the L1 HB 502 may clear every entry where the condition “Flush ITAG≤ITAG” is met. In one embodiment, the L1 HB 502 may clear an entry by setting one or more of writeback bit (W), RP_ITAG_only, RP, transactional memory bit (TM), ITAG_V, Evictor_ITAG_V to “0”. In one embodiment, once the flush compares are completed, there may be two vectors of HB entries to be restored. One vector may be used to indicate which HB entries have to restore ITAG only, and another vector may be used to indicate which HB entries have to restore ITAG and WB data.

FIG. 6 illustrates an example of a HB restoration component restoring entries from a distributed HB, according to one embodiment. Note that while FIG. 6 shows the restore function for one level (e.g., L1 HB) of the distributed HB, those of ordinary skill in the art will recognize that the HB restoration component may perform the restore function for each level of the distributed HB.

For each cycle of N cycles, where N is the number of entries to restore, the HB restoration component may select one entry (e.g., the first entry) with RP_ITAG_only=1, and one entry (e.g., the first entry) with RP_WB=1, read out the entries, and broadcast the entries to all eight slices of the multi-slice processor 300. As shown in this example, once the HB restoration component selects an entry of the L1 HB 502, the HB restoration component reads out the LREG, ITAG and any available data associated with the entry. The HB restoration component then clears the HB entry. For example, the HB restoration component can clear bits RP_ITAG_only, RP_WB W, ITAG_Valid, Evictor_ITAG Valid, etc. Once the entry is cleared, the HB restoration component repeats the process of selecting the next two entries, reading the entries, broadcasting the entries to the processing slices, and clearing the entries until there no remaining entries to restore (e.g., there are no entries with RP=1).

FIG. 7 is a flow chart illustrating a method 700 for performing a flush and restore of a distributed HB in a processing unit, according to one embodiment. The method 700 can be performed by a processing unit (e.g., CPU 110) or one or more components (e.g., HB restoration component, HB unit 214, etc.) of the processing unit.

As shown, the method 700 begins at block 702, where the processing unit determines one or more entries in a history buffer (e.g., one or more levels of a distributed HB) to restore to a register file. For example, as noted, the processing unit can perform magnitude compares of the ITAG for each entry of the history buffer against a flush ITAG (received from a logic unit) and mark the entries as restore pending if the comparison satisfies a predetermined condition. For the history buffer entries that are marked as restore pending, the processing unit can indicate whether the entries are associated with “ITAG only” restoration (e.g., RP_ITAG_only=1) or whether the entries are associated with “ITAG+WB data” restoration (e.g., RP_WB=1).

At block 704, the processing unit reads out a first HB entry with an ITAG only to restore and a second HB entry with an ITAG and writeback data to restore. At block 706, the processing unit sends the first HB entry directly to the register file via a dedicated ITAG bus that bypasses the issue queue and execution unit of the processing unit. At block 708, the processing unit sends the second HB entry to the register file via the normal write back mechanism (e.g., via the issue queue, execution unit and WB bus 230). In some embodiments, the processing unit may send the first HB entry and the second HB entry at the same time (e.g., synchronously). At block 708, the processing unit repeats the operations in blocks 704-708 (e.g., until there are no remaining HB entries to restore to the register file).

FIG. 8 is a flow chart illustrating a method 800 for performing a flush and restore of a distributed HB in a processing unit, according to one embodiment. The method 800 can be performed by a processing unit (e.g., CPU 110) or one or more components (e.g., HB restoration component, HB unit 214, etc.) of the processing unit.

As shown, the method 800 begins at block 802, where the processing unit identifies (e.g., based on a result of one or more magnitude compares with a received flush ITAG) one or more entries in a history buffer to restore to a register file. At 804, the processing unit determines, from the identified HB entries, whether there are any “ITAG only” HB entries to restore. If there are “ITAG only” HB entries available to restore to the register file, the processing unit reads out an “ITAG only” HB entry (block 806) and reads out an “ITAG+WB data” HB entry (if available) (block 808). The processing unit sends the “ITAG only” HB entry via the dedicated ITAG bus (e.g., ITAG bus 330) and the “ITAG+WB data” HB entry via the ITAG+WB bus (e.g., ITAG+WB bus 340) at the same time (e.g., synchronously). The method then proceeds to block 818.

If at block 804, the processing unit determines there are no “ITAG only” HB entries to restore, the processing unit reads out the ITAG and WB data for one of the HB entries (block 812). At block 814, the processing unit sends the ITAG for the HB entry to the register file via the dedicated ITAG bus. At block 816, the processing unit sends the WB data for the HB entry to the register file via the ITAG+WB bus. At block 818, the processing unit determines if there are remaining HB entries to restore. If there are remaining HB entries to restore, the method proceeds to block 804. Otherwise, the method ends.

The descriptions of the various embodiments of the present disclosure have been presented for purposes of illustration, but are not intended to be exhaustive or limited to the embodiments disclosed. Many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The terminology used herein was chosen to best explain the principles of the embodiments, the practical application or technical improvement over technologies found in the marketplace, or to enable others of ordinary skill in the art to understand the embodiments disclosed herein.

In the following, reference is made to embodiments presented in this disclosure. However, the scope of the present disclosure is not limited to specific described embodiments. Instead, any combination of the following features and elements, whether related to different embodiments or not, is contemplated to implement and practice contemplated embodiments. Furthermore, although embodiments disclosed herein may achieve advantages over other possible solutions or over the prior art, whether or not a particular advantage is achieved by a given embodiment is not limiting of the scope of the present disclosure. Thus, the following aspects, features, embodiments and advantages are merely illustrative and are not considered elements or limitations of the appended claims except where explicitly recited in a claim(s). Likewise, reference to “the invention” shall not be construed as a generalization of any inventive subject matter disclosed herein and shall not be considered to be an element or limitation of the appended claims except where explicitly recited in a claim(s).

Aspects of the present disclosure may take the form of an entirely hardware embodiment, an entirely software embodiment (including firmware, resident software, microcode, etc.) or an embodiment combining software and hardware aspects that may all generally be referred to herein as a “circuit,” “module” or “system.”

The present invention may be a system, a method, and/or a computer program product. The computer program product may include a computer readable storage medium (or media) having computer readable program instructions thereon for causing a processor to carry out aspects of the present invention.

The computer readable storage medium can be a tangible device that can retain and store instructions for use by an instruction execution device. The computer readable storage medium may be, for example, but is not limited to, an electronic storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination of the foregoing. A non-exhaustive list of more specific examples of the computer readable storage medium includes the following: a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), a static random access memory (SRAM), a portable compact disc read-only memory (CD-ROM), a digital versatile disk (DVD), a memory stick, a floppy disk, a mechanically encoded device such as punch-cards or raised structures in a groove having instructions recorded thereon, and any suitable combination of the foregoing. A computer readable storage medium, as used herein, is not to be construed as being transitory signals per se, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through a waveguide or other transmission media (e.g., light pulses passing through a fiber-optic cable), or electrical signals transmitted through a wire.

Computer readable program instructions described herein can be downloaded to respective computing/processing devices from a computer readable storage medium or to an external computer or external storage device via a network, for example, the Internet, a local area network, a wide area network and/or a wireless network. The network may comprise copper transmission cables, optical transmission fibers, wireless transmission, routers, firewalls, switches, gateway computers and/or edge servers. A network adapter card or network interface in each computing/processing device receives computer readable program instructions from the network and forwards the computer readable program instructions for storage in a computer readable storage medium within the respective computing/processing device.

Computer readable program instructions for carrying out operations of the present invention may be assembler instructions, instruction-set-architecture (ISA) instructions, machine instructions, machine dependent instructions, microcode, firmware instructions, state-setting data, or either source code or object code written in any combination of one or more programming languages, including an object oriented programming language such as Smalltalk, C++ or the like, and conventional procedural programming languages, such as the “C” programming language or similar programming languages. The computer readable program instructions may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the latter scenario, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet Service Provider). In some embodiments, electronic circuitry including, for example, programmable logic circuitry, field-programmable gate arrays (FPGA), or programmable logic arrays (PLA) may execute the computer readable program instructions by utilizing state information of the computer readable program instructions to personalize the electronic circuitry, in order to perform aspects of the present invention.

Aspects of the present invention are described herein with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and/or block diagrams, and combinations of blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer readable program instructions.

These computer readable program instructions may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions/acts specified in the flowchart and/or block diagram block or blocks. These computer readable program instructions may also be stored in a computer readable storage medium that can direct a computer, a programmable data processing apparatus, and/or other devices to function in a particular manner, such that the computer readable storage medium having instructions stored therein comprises an article of manufacture including instructions which implement aspects of the function/act specified in the flowchart and/or block diagram block or blocks.

The computer readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device to cause a series of operational steps to be performed on the computer, other programmable apparatus or other device to produce a computer implemented process, such that the instructions which execute on the computer, other programmable apparatus, or other device implement the functions/acts specified in the flowchart and/or block diagram block or blocks.

The flowchart and block diagrams in the Figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of instructions, which comprises one or more executable instructions for implementing the specified logical function(s). In some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems that perform the specified functions or acts or carry out combinations of special purpose hardware and computer instructions.

While the foregoing is directed to embodiments of the present invention, other and further embodiments of the invention may be devised without departing from the basic scope thereof, and the scope thereof is determined by the claims that follow. 

What is claimed is:
 1. A method for performing a flush and restore of a history buffer (HB) in a processing unit, the method comprising: identifying one or more entries of the HB to restore to a register file in the processing unit; determining, for each of the one or more HB entries, whether to send the HB entry to the register file via a first restore bus or via a second restore bus, different from the first restore bus, based on contents of the HB entry; and sending each of the one or more HB entries to the register file via one of the first restore bus or the second restore bus, based on the determination.
 2. The method of claim 1, wherein: the determination comprises determining to send the HB entry to the register file via the first restore bus if the HB entry does not include writeback data; and sending the HB entry to the register file comprises sending the HB entry to the register file via the first restore bus.
 3. The method of claim 1, wherein: the determination comprises determining to send the HB entry to the register file via the second restore bus if the HB entry does include writeback data; and sending the HB entry to the register file comprises sending the HB entry to the register file via the second restore bus.
 4. The method of claim 1, wherein: sending each of the one or more HB entries to the register file comprises sending a first HB entry to the register file via the first restore bus and sending a second HB entry to the register file via the second restore bus at a same time; the first HB entry does not include writeback data; and the second HB entry does include writeback data.
 5. The method of claim 1, wherein: sending each of the one or more HB entries to the register file comprises sending a first portion of the HB entry to the register file via the first restore bus; and once a predetermined amount of time has elapsed after sending the first portion of the HB entry, sending a second portion of the HB entry to the register file via the second restore bus.
 6. The method of claim 5, wherein: the first portion comprises an instruction tag (ITAG) of the HB entry; and the second portion comprises writeback data of the HB entry.
 7. The method of claim 1, wherein identifying the one or more HB entries comprises: selecting a first one or more HB entries that satisfy a first condition to restore to the register file in the processing unit, wherein the first condition is based on an instruction tag (ITAG) of each HB entry, an evictor ITAG of the HB entry and a flush ITAG; and selecting a second one or more HB entries that satisfy a second condition to invalidate, wherein the second condition is based on the ITAG of the HB entry and the flush ITAG.
 8. The method of claim 1, wherein: the first restore bus comprises a dedicated restore bus from the HB to the register file; and the dedicated restore bus bypasses an issue queue and execution unit in the processing unit.
 9. The method of claim 1, wherein: the second restore bus comprises a writeback bus from an execution unit in the processing unit to the register file.
 10. The method of claim 1, wherein the HB comprises a multi-level HB comprising at least a first level HB and a second level HB different from the first level HB.
 11. A system, comprising: at least one processor comprising a register file and a history buffer (HB); and a memory storing a program, which, when executed on the at least one processor, perform an operation for performing a flush and restore of the HB, the operation comprising: identifying one or more entries of the HB to restore to the register file; determining, for each of the one or more HB entries, whether to send the HB entry to the register file via a first restore bus or via a second restore bus, different from the first restore bus, based on contents of the HB entry; and sending each of the one or more HB entries to the register file via one of the first restore bus or the second restore bus, based on the determination.
 12. The system of claim 11, wherein: the determination comprises determining to send the HB entry to the register file via the first restore bus if the HB entry does not include writeback data; and sending the HB entry to the register file comprises sending the HB entry to the register file via the first restore bus.
 13. The system of claim 11, wherein: the determination comprises determining to send the HB entry to the register file via the second restore bus if the HB entry does include writeback data; and sending the HB entry to the register file comprises sending the HB entry to the register file via the second restore bus.
 14. The system of claim 11, wherein: sending each of the one or more HB entries to the register file comprises sending a first HB entry to the register file via the first restore bus and sending a second HB entry to the register file via the second restore bus at a same time; the first HB entry does not include writeback data; and the second HB entry does include writeback data.
 15. The system of claim 11, wherein: sending each of the one or more HB entries to the register file comprises sending a first portion of the HB entry to the register file via the first restore bus; and once a predetermined amount of time has elapsed after sending the first portion of the HB entry, sending a second portion of the HB entry to the register file via the second restore bus.
 16. The system of claim 11, wherein: the first restore bus comprises a dedicated restore bus from the HB to the register file; the dedicated restore bus bypasses an issue queue and execution unit in the processor; and the second restore bus comprises a writeback bus from the execution unit to the register file.
 17. A computer program product, the computer program product comprising: a computer-readable storage medium having computer-readable program code embodied therewith, the computer-readable program code executable by one or more computer processors to perform an operation for performing a flush and restore of a history buffer (HB) in a processing unit, the operation comprising: identifying one or more entries of the HB to restore to a register file in the processing unit; determining, for each of the one or more HB entries, whether to send the HB entry to the register file via a first restore bus or via a second restore bus, different from the first restore bus, based on contents of the HB entry; and sending each of the one or more HB entries to the register file via one of the first restore bus or the second restore bus, based on the determination.
 18. The computer program product of claim 17, wherein: the determination comprises determining to send the HB entry to the register file via the first restore bus if the HB entry does not include writeback data; and sending the HB entry to the register file comprises sending the HB entry to the register file via the first restore bus.
 19. The computer program product of claim 17, wherein: the determination comprises determining to send the HB entry to the register file via the second restore bus if the HB entry does include writeback data; and sending the HB entry to the register file comprises sending the HB entry to the register file via the second restore bus.
 20. The computer program product of claim 17, wherein: the first restore bus comprises a dedicated restore bus from the HB to the register file; the dedicated restore bus bypasses an issue queue and execution unit in the processing unit; and the second restore bus comprises a writeback bus from the execution unit to the register file. 